package com.xxx.shetuan3.dao;

import com.xxx.shetuan3.pojo.Notice;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

@Mapper
@Repository
public interface NoticeDao {
    @Insert("insert into notice  " +
            "(notice_name,content,date,organization_id)  " +
            "values (#{noticeName},#{content},#{date},#{organizationId}) ")
    public int saveNotice(Notice notice);

    @Delete("delete from notice where notice_id = #{noticeId}")
    public int deleteNoticeById(Integer noticeId);

    @Update("update notice " +
            "set notice_name=#{noticeName},content=#{content},date=#{date} " +
            "where notice_id=#{noticeId}")
    public int updateNotice(Notice notice);

    @Select("select notice_id noticeId,notice_name noticeName,content,date,organization_id organizationId " +
            "from notice " +
            "where notice_id=#{noticeId}")
    public Notice queryNoticeById(Integer noticeId);

    @Select("select notice_id noticeId,notice_name noticeName,content,date,organization_id organizationId " +
            "from notice "+
            "where organization_id=#{organizationId}")
    public List<Notice> queryNoticeByOrganizationId(Integer organizationId);

}
